from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver=webdriver.Chrome()
driver.get('https://www.baidu.com')


# driver.find_element_by_css_selector('a[href="/new-index/"]').click()
windowstabs=driver.window_handles
print(windowstabs)
# 获取当前浏览器的窗口


currenttab=driver.current_window_handle

driver.switch_to.window(windowstabs[1])